package cn.yhbk.web.modules.manager.Mapper;

import cn.yhbk.web.modules.manager.Pojo.DTO.Activity.ActivityDetailDto;
import cn.yhbk.web.modules.manager.Pojo.DTO.Activity.ActivityDto;
import cn.yhbk.web.modules.manager.Pojo.DTO.Activity.ActivityGpa;
import cn.yhbk.web.modules.manager.Pojo.Entity.ActivityDetail;
import cn.yhbk.web.modules.manager.Pojo.Entity.ActivityEntity;
import cn.yhbk.web.modules.manager.Pojo.VO.Activity.ActivityDetailResp;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.Arrays;
import java.util.List;

@Mapper
@Repository
public interface ActivityMapper extends BaseMapper<ActivityEntity> {
    List<ActivityDto> getActivityList();

    List<ActivityDetail> selectAList();

    List<ActivityDetail> selectBList();

    void insertADetail(ActivityDetail activityDetail);

    void insertBDetail(ActivityDetail activityDetail);

    List<ActivityGpa> selectGpaList();

    ActivityGpa selectGpaByContestNo(Long contestNo);

    void updateGpaByContestNo(ActivityGpa activityGpa);

    int queryADetailIsExit(@Param("grade") String grade, @Param("level") String level,
                           @Param("gpa") Double gpa);

    int queryBDetailIsExit(@Param("grade") String grade, @Param("level") String level,
                           @Param("gpa") Double gpa);

    void insertGpa(ActivityGpa activityGpa);


    List<ActivityDetailResp> selectGpaDetail(Long activityId);

    void updateADetail(@Param("gpa") Double gpa,
                       @Param("grade") String grade,
                       @Param("level") String level);

    void updateBDetail(@Param("gpa") Double gpa,
                       @Param("grade") String grade,
                       @Param("level") String level);

    void updateDetail(@Param("gpa") Double gpa,
                      @Param("sameTypeAdd") Double sameTypeAdd,
                      @Param("type") String type,
                      @Param("activityId") String activityId);
}
